package IOStream;

import java.io.*;
import java.util.List;

/**
 * @Author Jeremy Zheng
 * @Date 2021/2/26 14:46
 * @Version 1.0
 */
public class AddChangeDemo {

    public static void readAndChange(String fileIn,String fileOut) throws Exception {
        BufferedReader reader = new BufferedReader(new FileReader(fileIn));
        BufferedWriter writer = new BufferedWriter(new FileWriter(fileOut));
        while (true){
            String s = reader.readLine();
            if(s==null||s==""){
                reader.close();
                writer.close();
                break;
            }
            String[] values = s.split("\t");
            writer.write("INSERT INTO ct_user(tel,username)VALUES("+values[0]+","+"'"+values[1]+"'"+");"+"\n");
            writer.flush();
        }

    }

    public static void main(String[] args){
        try {
            readAndChange("E:\\zmyy\\大三\\项目\\大数据实战电信客服\\2.资料\\辅助文档\\contact.log",
                    "E:\\zmyy\\大三\\项目\\大数据实战电信客服\\2.资料\\辅助文档\\contact2.log");
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
